home *** CD-ROM | disk | FTP | other *** search
- unit people;
-
- {*** Ignore everything in this unit, it's only my Random People Generator (tm) code ***}
-
- interface
-
- uses ComCtrls;
-
- procedure GeneratePeople(aListView: TListView);
-
- implementation
-
- uses Windows, Forms, Controls, SysUtils;
-
- procedure GeneratePeople(aListView: TListView);
- type
- TRandPerson = array [1..10] of string;
- const
- cLastName: TRandPerson = ('Smith', 'Bradshaw', 'Jennings', 'Deneuve', 'Morrison', 'Churchill',
- 'Brown', 'Green', 'Arnold', 'Washington');
-
- cFirstName: TRandPerson = ('Jeff', 'Craig', 'Walter', 'Scot', 'Joe', 'Frank',
- 'Cathy', 'Anne', 'Victoria', 'Stephanie');
-
- cOccupation: TRandPerson = ('Cook', 'Programmer', 'Engineer', 'Driver', 'Storekeeper',
- 'Accountant', 'Manager', 'Artist', 'Musician', 'Lawyer');
-
- cHobby: TRandPerson = ('Skiing', 'Fishing','Collecting', 'Drawing', 'Skating', 'Dancing',
- 'Watching TV', 'Movies', 'Cooking','Shopping');
-
- cNumPeople = 50;
-
- function GetRandom(r: Integer): Integer;
- begin
- Randomize;
- Sleep(7);
- Result := Random(r-1) + 1;
- end;
-
- var
- i: Integer;
-
- begin
- { Ignore all code in this event handler... It's my Automatic People Generator (tm)}
- with aListView do
- try
- Screen.Cursor := crHourglass;
- Items.BeginUpdate;
-
- for i := 1 to cNumPeople do
- with Items.Add do
- begin
- Caption := cLastName[GetRandom(10)];
- SubItems.Add(cFirstName[GetRandom(10)]);
- SubItems.Add(IntToStr(GetRandom(50) + 18));
- SubItems.Add(cOccupation[GetRandom(10)]);
- SubItems.Add(cHobby[GetRandom(10)]);
- end;
-
- finally
- Items.EndUpdate;
- Screen.Cursor := crDefault;
- end;
-
- end;
-
- end.
-